package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.FoxCardConfig;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;
import java.util.List;

/**
 * 回合结束时统计剩余弃牌次数加金币，弃牌次数x|金币y|0|0|0|0
 * 弃牌次数x|金币y|0|0|0|0
 */
public class FoxCardEffect56 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType != eFoxCardTriggerType.ROUND_END) {
            return;
        }

        int perTimes = Integer.valueOf(effectConfig.getParamsList().get(0));
        int leftTimes = gameLogic.getGameData().getDropCardTimes();
        int totalTimes = leftTimes / perTimes;

        int goldChange = totalTimes * Integer.valueOf(effectConfig.getParamsList().get(1));
        List<FoxBaseCard> foxEffectCards = Collections.singletonList(effectCard);
        gameLogic.goldChange(goldChange, foxEffectCards, null, triggerType); //加金币
    }
}
